package shop;

import java.math.BigDecimal;

/**
 * @Description：
 * @Author: 杨涌仁
 * @Date: 2022/10/13
 */
public class ApplePay implements FruitPay {
    /**
     * 根据苹果的重量计算买苹果要支付多少钱
     * @param weight
     * @return
     */
    @Override
    public double totalPay(int weight) {

        BigDecimal appleUnitPrice = new BigDecimal(String.valueOf(8));
        BigDecimal appleWeight = new BigDecimal(String.valueOf(weight));
        return appleUnitPrice.multiply(appleWeight).doubleValue();
    }
}
